Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of missing bin file in gltf separate #94506

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

Jordyfel
Copy link
Contributor

Fix #85177

The missing .bin file case was not handled very well, because the error check after attempting to load it checked the wrong variable, so the function returned OK and errors popped up elsewhere.

Since it's very possible for the user to miss moving the .bin when moving gltf separate in the editor filesystem (because it isn't visible), adding another check to more explicitly complain that the file is missing.

Errors before:

  Can't open file from path 'res://untitled.bin'.
  modules/gltf/gltf_document.cpp:1323 - Condition "(int)(offset + buffer_end) > buffer.size()" is true. Returning: ERR_PARSE_ERROR
  modules/gltf/gltf_document.cpp:1323 - Condition "(int)(offset + buffer_end) > buffer.size()" is true. Returning: ERR_PARSE_ERROR
  modules/gltf/gltf_document.cpp:2868 - Condition "vertex_num <= 0" is true. Returning: ERR_INVALID_DECLARATION
  modules/gltf/gltf_document.cpp:7251 - Condition "err != OK" is true. Returning: ERR_PARSE_ERROR
  modules/gltf/gltf_document.cpp:6895 - Condition "err != OK" is true. Returning: err
  modules/gltf/gltf_document.cpp:7426 - Condition "err != OK" is true. Returning: err
  Error importing 'res://untitled.gltf'.

Errors after:

  glTF: Binary file not found: res://untitled.bin
  modules\gltf\gltf_document.cpp:7207 - Condition "err != OK" is true. Returning: ERR_PARSE_ERROR
  modules\gltf\gltf_document.cpp:6896 - Condition "err != OK" is true. Returning: err
  modules\gltf\gltf_document.cpp:7427 - Condition "err != OK" is true. Returning: err
  Error importing 'res://untitled.gltf'.

@Jordyfel Jordyfel requested a review from a team as a code owner July 18, 2024 11:24
@AThousandShips AThousandShips added bug topic:3d cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:import labels Jul 18, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Jul 18, 2024
@akien-mga akien-mga modified the milestones: 4.4, 4.3 Jul 18, 2024
@akien-mga akien-mga removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Jul 18, 2024
@akien-mga akien-mga merged commit ff8a278 into godotengine:master Jul 18, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@Jordyfel Jordyfel deleted the handle-gltf-bin-missing branch July 18, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:import topic:3d
Projects
None yet
3 participants